package com.gf.forcesystem.controller;

import com.gf.forcesystem.model.dto.CotaskingTargetState;
import com.gf.forcesystem.model.dto.UAVState;
import com.gf.forcesystem.api.CotaskingTargetStateService;
import com.gf.forcesystem.api.UavStateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author gaofei
 * @date 2022/6/21 20:05
 */
@RestController
@RequestMapping("uva")
@Api(tags = "无人机状态模拟")
public class UavStateController {
    @Resource
    List<UavStateService> uavStateServiceList;

    @Resource
    List<CotaskingTargetStateService> cotaskingTargetStateServices;

    @ApiOperation("状态帧模拟")
    @PostMapping("simulationUavState")
    public Boolean simulationUavState(@RequestBody UAVState uavState) {
        uavStateServiceList.forEach(uavStateService -> uavStateService.deal(uavState));
        return true;
    }

    @ApiOperation("无人机目标状态模拟")
    @PostMapping("simulationTargetState")
    public Boolean simulationTargetState(@RequestBody CotaskingTargetState cotaskingTargetState) {
        cotaskingTargetStateServices.forEach(cotaskingTargetStateService -> cotaskingTargetStateService.deal(cotaskingTargetState));
        return true;
    }
}
